use std::error::Error;

pub trait IntoBox<T> {
    fn into_box(self) -> Box<T>;
}

impl<T> IntoBox<T> for T {
    fn into_box(self) -> Box<T> {
        Box::new(self)
    }
}

pub trait Ignore {
    fn ignore(self);
}

impl<T> Ignore for T {
    fn ignore(self) {}
}

pub type GenError = Box<dyn Error + Send + Sync>;
pub type GenResult<T> = Result<T, GenError>;
pub type StaticError = Box<dyn Error + Send + Sync + 'static>;
pub type StaticResult<T> = Result<T, StaticError>;
pub trait FromRef<T> {
    fn from_ref(t: &T) -> Self;
}
pub trait RefInto<T> {
    fn ref_into(&self) -> T;
}
impl<D: FromRef<S>, S> RefInto<D> for S {
    fn ref_into(&self) -> D {
        D::from_ref(self)
    }
}
impl<T: Clone> FromRef<T> for T {
    fn from_ref(t: &T) -> Self {
        t.clone()
    }
}
